package com.central.common.feign;

import com.central.common.constant.ServiceNameConstants;
import com.central.common.model.FileInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Tindy
 * @date 2021/6/29
 * @describe
 */
@FeignClient(name = ServiceNameConstants.FILE_SERVICE, decode404 = true)
public interface FileService {
    /**
     * 上传文件
     *
     * @return
     */
    @PostMapping(value = "/files-anon",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    FileInfo upload(@RequestPart("file") MultipartFile file);

    /**
     * 引用文件
     * @param url
     * @param msg
     * @return
     */
    @GetMapping("/pv/quoteFile")
    Long quoteFile(@RequestParam("url") String url,@RequestParam("msg") String msg);

    /**
     * 删除引用
     *
     * @param id
     * @return
     */
    @DeleteMapping("/pv/delQuote")
    void delQuote(@RequestParam("id") Long id);
}